// 组合
var combine = function(n, k) {
    const res =[], path = [];
    backtracking(n, 1);
    return res;
    
    function backtracking(n, index) {
        if(path.length === k) {
            // res.push(Array.from(path));
            res.push([...path])
            return;
        }  
        for (let i = index; i <=n; i++ ) {
            path.push(i);
            backtracking(n, i+1);
            path.pop();
        }
    }
};